package cn.gson.fengboot.controller;

import cn.gson.fengboot.model.pojos.Zdeliverylog;
import cn.gson.fengboot.model.pojos.Zdeliverylogdelivery;
import cn.gson.fengboot.model.pojos.Zinvoice;
import cn.gson.fengboot.model.service.ZdeliverylogService;
import cn.gson.fengboot.model.service.ZinvoiceService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/jfjl")
public class ZdeliverylogController {
    @Autowired
    ZdeliverylogService fpservice;

    //交付记录查询方法
    @RequestMapping("/list_jl")
    @ResponseBody
    public Map<String,Object> kaipiao(Integer page, Integer size,String search){
        Page<Object> obj = PageHelper.startPage(page, size);
        fpservice.kaipiao(search);

        Map<String,Object> map = new HashMap<>();
        map.put("total",obj.getTotal());
        map.put("rows",obj.getResult());
        return map;
    }

    //交付记录查询方法
    @RequestMapping("/list_xqjl")
    @ResponseBody
    public List<Zdeliverylog> jiaofuxq(String search){
        return fpservice.jiaofuxq(search);
    }

    //交付记录查询方法
    @RequestMapping("/list_jlcp")
    @ResponseBody
    public List<Zdeliverylogdelivery> kaipiao2(String search){


        return fpservice.kaipiao2(search);
    }

    //新增
    @RequestMapping("/add_fapiao")
    @ResponseBody
    public void addfapiao(@RequestBody Zdeliverylog fp){
        fpservice.add(fp);
    }
}
